
/*弹框*/
Vue.filter('formatSpeed',function(num){
    var tkb = parseInt(num/1024);
    if(tkb<1024){
        return tkb+'Kb/s';
    }else{
        var tmb = parseInt(tkb/1024);
        var smb = ((tkb%1024)/1024).toFixed(2);

        var speed = tmb+'.'+smb+'Mb/s'
    }
})
var commonDialogAlert = Vue.component('commonDialogAlert', {
    template: '<transition><div class="modal fade" :class="{\'in\':showAlert}">\
                  <div class="modal-dialog modal-sm">\
                      <div class="modal-content">\
                          <div class="modal-header">\
                              <button type="button" class="close" data-dismiss="modal"><span v-on:click="showAlert = !showAlert">×</span><span class="sr-only">Close</span></button>\
                              <h4 class="modal-title" id="myLargeModalLabel">{{datafrom.title}}</h4>\
                          </div>\
                          <div class="modal-body">\
                              {{datafrom.content}}\
                          </div>\
                          <div class="modal-footer">\
                                  <div class="btn btn-sm btn-danger" v-on:click="showAlert = !showAlert">{{datafrom.leftBtn}}</div>\
                                  <div class="btn btn-sm btn-success" v-on:click="sureBtn()">{{datafrom.rightBtn}}</div>\
                          </div>\
                      </div>\
                  </div>\
              </div></transition>',
    data:function(){
        return {
                    "showAlert":true,
                    "viewData":"",
                    "handle":new requestController()
                    // "alertDetail":'',按钮的提交地址等数据
                    // "btnPostData":'',/*需要提交的字段*/
                }
    },
    props:['datafrom',"btnPostData","alertDetail"],
    mounted:function(){
        console.log('弹框模版渲染完成'+this.$options.propsData.btnPostData);
    },
    methods:{
        sureBtn:function(){
            let data = this.$options.propsData.alertDetail;
            let postArg = this.$options.propsData.btnPostData;
            /*请求详情页*/
            let url = data.apiName;
            let postData = {};
            data.parameter.map(function(item,index){
                if(item.type == 'id'){
                    item.value = postArg;
                }
                postData[item.key] = item.value;
            });

            //console.log('确定数据=>'+JSON.stringify(postData)+'提交网址=>'+url);
            
            var postr = JSON.stringify(postData)
            //console.log(typeof(postr))
            this.$parent.$parent.request.setApiName(url);
            this.$parent.$parent.request.setRequest(postData);
            this.$parent.$parent.request.post();

            this.showAlert = !this.showAlert
        }
    }
});
/*弹框*/
var commonDialogInput = Vue.component('commonDialogInput', {
    template: '<transition><div class="modal fade" :class="{\'in\':showAlert}">\
                  <div class="modal-dialog modal-sm">\
                      <div class="modal-content">\
                          <div class="modal-header">\
                              <button type="button" class="close" data-dismiss="modal"><span v-on:click="hideThisDia">×</span><span class="sr-only">Close</span></button>\
                              <h4 class="modal-title" id="myLargeModalLabel">{{datafrom.title}}</h4>\
                          </div>\
                          <div class="modal-body">\
                              <textarea class="form-control" v-model="inputContent" placerholder="请输入拒绝理由（5个字以上）"></textarea>\
                          </div>\
                          <div class="modal-footer">\
                                  <div class="btn btn-sm btn-danger" v-on:click="hideThisDia">{{datafrom.leftBtn}}</div>\
                                  <div class="btn btn-sm btn-default active" v-if="inputContent.length<5">{{datafrom.rightBtn}}</div>\
                                  <div class="btn btn-sm btn-success" v-else v-on:click="sureBtn()">{{datafrom.rightBtn}}</div>\
                          </div>\
                      </div>\
                  </div>\
              </div></transition>',
    data:function(){
        return {
                    "showAlert":true,
                    "viewData":"",
                    "inputContent":'',
                    "handle":new requestController()
                    // "alertDetail":'',按钮的提交地址等数据
                    // "btnPostData":'',/*需要提交的字段*/
                }
    },
    props:['datafrom',"btnPostData","alertDetail"],
    mounted:function(){
        console.log('输入弹框模版渲染完成');
        console.log(this);
    },
    methods:{
        sureBtn:function(){
            let data = this.$options.propsData.alertDetail;
            let postArg = this.$options.propsData.btnPostData;
            let _this = this;
            /*请求详情页*/
            let url = data.apiName;
            let postData = {};
            data.parameter.map(function(item,index){
                if(item.type == 'id'){
                    item.value = postArg;
                }
                if(item.type == 'input'){
                    item.value = _this.inputContent;
                }
                postData[item.key] = item.value;
            });

            //console.log('确定数据=>'+JSON.stringify(postData)+'提交网址=>'+url);
            //console.log(this.$parent)
            var postr = JSON.stringify(postData)
            //console.log(typeof(postr))
            this.$parent.$parent.request.setApiName(url);
            this.$parent.$parent.request.setRequest(postData);
            this.$parent.$parent.request.post();

            this.showAlert = !this.showAlert
            
        },
        hideThisDia:function(){
            this.inputContent = '';
            this.showAlert = !this.showAlert;
        }
    }
});
/*模态框（展示数据详情）*/
var commonDetail = Vue.component('commonDetail', {
    template: '<transition><div class="modal fade" :class="{\'in\':showModal}">\
                  <div class="modal-dialog modal-lg">\
                      <div class="modal-content">\
                          <div class="modal-header">\
                              <button type="button" class="close" data-dismiss="modal"><span v-on:click="showModal = !showModal">×</span><span class="sr-only">Close</span></button>\
                              <h4 class="modal-title" id="myLargeModalLabel">数据详情</h4>\
                          </div>\
                          <div class="modal-body modalMaxHeight">\
                              <div class="table-responsive">\
                                  <table class="table table-bordered table-hover table-striped">\
                                      <tbody>\
                                          <tr v-for="(val,key) in data">\
                                              <td width="20%">{{key}}</td>\
                                              <td width="80%" v-html="val"></td>\
                                          </tr>\
                                      </tbody>\
                                  </table>\
                              </div>\
                          </div>\
                          <div class="modal-footer">\
                              <div class="btn btn-sm btn-primary" v-for="btn in detailBtns" v-on:click="diaplayEvent(btn)">{{btn.title}}</div>\
                          </div>\
                      </div>\
                  </div>\
                  <components :is="alerts" :datafrom="alertData" ref="tankuang" :btnPostData="bD" :alertDetail="aD"></components>\
              </div></transition>',
    data:function(){
        return {
                    "showModal":false,
                    "title":'',
                    "data":[],
                    "detailBtns":[],
                    "alerts":'',
                    "alertData":{},
                    "bD":'',
                    "aD":'',
                    "reg":/[^\s]+\.(jpg|gif|png|bmp)/i
                }
    },
    props:['datafrom'],
    mounted:function(){
        console.log('模态框模版渲染完成');
    },
    methods:{
        diaplayEvent:function(btnData){
            this.alerts = btnData.functionName;
            var _this = this;

            var alertJson = this.$parent.$data.request.getJsonModel(btnData.app,btnData.model);

            this.aD = alertJson;
            this.bD = btnData.parameter;

            alertJson.text.map(function(val,index){
                _this.alertData[val.key] = _this.$parent.$data.request.getText(val.langCode);
            });
            this.$refs.tankuang.showAlert = true;
        }
    }
});


var publishNews = Vue.component('publishNews',{
    template:'<div class="row">\
                  <div class="col-sm-8 col-sm-offset-2">\
                      <div class="page-header">\
                          <h2>新闻发布</h2>\
                          <h6 class="text-danger">小提示：新闻封面的上传失败或上传长时间无响应需要刷新页面，建议先上传新闻封面！<b style="color:#fff">提交后无状态提示！待修复</b></h6>\
                      </div>\
                      <div class="form-group">\
                          <div class="input-group">\
                              <label>新闻分类</label>\
                              <select v-model="newsData.catId" class="form-control" placeholder="请输入新闻标题">\
                                  <option value="null">请选择</option>\
                                  <option v-for="list in articleCat" :value="list.categoryID">{{list.categoryName}}</option>\
                              </select>\
                          </div>\
                      </div>\
                      <div class="form-group">\
                          <label>新闻标题</label>\
                          <input v-model="newsData.title" class="form-control" placeholder="请输入新闻标题"/>\
                      </div>\
                      <div class="form-group">\
                          <label>文章链接</label>\
                          <input v-model="newsData.nurl" type="url" class="form-control" placeholder="请输入完整的URL地址。示例：http://www.baidu.com" />\
                      </div>\
                      <div class="form-group">\
                          <label>新闻简介</label>\
                          <textarea v-model="newsData.describ" class="form-control" placeholder="请输入新闻简介"></textarea>\
                      </div>\
                      <div class="form-group">\
                          <label>新闻封面</label>\
                          <div id="uploadPicWap" class="uploadPicWap">\
                              <div id="suoluetu" style="display:none">\
                                  <div id="present">\
                                  <div class="lineCtrl">\
                                      {{uPersent}}:{{uPercent}}%</br>\
                                      <i style="font-size:12px">速度：{{upSpeed | formatSpeed}}</i><br>\
                                      {{uploadFileName}}</div>\
                                  </div>\
                                  <div id="finshedUp"><img :src="uploadPic"/></div>\
                              </div>\
                              <div id="uploadPic" class="btn btn-primary btn-sm" v-if="uploadBtn == \'base\'">上传新闻封面</div>\
                          </div>\
                          <div>\
                              <div class="btn btn-primary btn-sm" v-on:click="startUpload()" v-if="uploadBtn == \'start\'">开始上传</div>\
                              <div class="btn btn-primary btn-sm" v-if="uploadBtn == \'finish\'">已完成</div>\
                          </div>\
                      </div>\
                      <div class="text-center">\
                          <div class="btn btn-success" v-on:click="submitData()">提交审核</div>\
                      </div>\
                  </div>\
            </div>',
    mounted:function(){
        console.log('发布新闻模版渲染完成');
        //初始化upToken
        this.getUptoken();
        //请求文章分类信息；
        this.getCatList();
    },
    data:function(){
        return {
            base64EncodeChars :"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
            useToken:'',
            buttonShow:false,
            newsData:{
                catId:'null',
                title:'',
                nurl:'',
                describ:'',
                imgs:''
            },
            qiniu:{},
            uPersent:'等待上传',
            uploadPic:'',
            uploadFileName:'',
            uploadBtn:'base',
            qiniuReturnBody : {},
            qnDoMain:'http://files.zonetry.com',/*七牛服务器域名*/
            qnBucket:'platform',/*七牛的buket名称*/
            articleCat:[],
            uPercent:0,
            upSpeed:0
        }
    },
    methods:{
        getCatList:function(){
            //发送请求
            var postNews = {};

            indexController.request.setApiName('/Datadict/ArticleCategory/List');
            indexController.request.setRequest(postNews);
            indexController.request.post();
            var resData = indexController.request.getResponse();
            this.articleCat = resData;
        },
        getUptoken:function(){
            var postd = {"namespace": "news/logo","fileExt": "png"};
            indexController.request.setApiName('/Upload/Token/Single');
            indexController.request.setRequest(postd);
            indexController.request.post();
            var resData = indexController.request.getResponse();
            this.useToken = resData.fileToken;

            //初始化按钮方法
            if(this.useToken){
                this.uploader();
            }else{
                alert('初始化失败！')
            }
        },
        uploader:function(){
            var _this = this;
            _this.qiniu = Qiniu.uploader({
                runtimes: 'html5,flash,html4',      // 上传模式,依次退化
                browse_button: 'uploadPic',         // 上传选择的点选按钮，**必需**
                // 在初始化时，uptoken, uptoken_url, uptoken_func 三个参数中必须有一个被设置
                // 切如果提供了多个，其优先级为 uptoken > uptoken_url > uptoken_func
                // 其中 uptoken 是直接提供上传凭证，uptoken_url 是提供了获取上传凭证的地址，如果需要定制获取 uptoken 的过程则可以设置 uptoken_func
                uptoken : _this.useToken, // uptoken 是上传凭证，由其他程序生成
                //uptoken_url: '/uptoken',         // Ajax 请求 uptoken 的 Url，**强烈建议设置**（服务端提供）
                // uptoken_func: function(file){    // 在需要获取 uptoken 时，该方法会被调用
                //    // do something
                //    return uptoken;
                // },
                get_new_uptoken: false,             // 设置上传文件的时候是否每次都重新获取新的 uptoken
                // downtoken_url: '/downtoken',
                // Ajax请求downToken的Url，私有空间时使用,JS-SDK 将向该地址POST文件的key和domain,服务端返回的JSON必须包含`url`字段，`url`值为该文件的下载地址
                unique_names: true,              // 默认 false，key 为文件名。若开启该选项，JS-SDK 会为每个文件自动生成key（文件名）
                // save_key: true,                  // 默认 false。若在服务端生成 uptoken 的上传策略中指定了 `sava_key`，则开启，SDK在前端将不对key进行任何处理
                domain: _this.qnDoMain,     // bucket 域名，下载资源时用到，**必需**
                container: 'uploadPicWap',             // 上传区域 DOM ID，默认是 browser_button 的父元素，
                max_file_size: '100mb',             // 最大文件体积限制
                flash_swf_url: 'path/of/plupload/Moxie.swf',  //引入 flash,相对路径
                max_retries: 3,                     // 上传失败最大重试次数
                dragdrop: true,                     // 开启可拖曳上传
                drop_element: 'uploadPicWap',          // 拖曳上传区域元素的 ID，拖曳文件或文件夹后可触发上传
                chunk_size: '4mb',                  // 分块上传时，每块的体积
                auto_start: false,                   // 选择文件后自动上传，若关闭需要自己绑定事件触发上传,
                multi_selection: false,              //限制智能选择一个文件，多文件改为true
                init: {
                    'FilesAdded': function(up, files) {
                        //console.log(files[0].getNative())
                        _this.uploadBtn = 'start';
                        document.getElementById('suoluetu').style.display="block";
                        _this.uploadFileName = files[0].name
                        /*
                        plupload.each(files, function(file) {
                            // 文件添加进队列后,处理相关的事情
                            console.log('文件已经添加进队列');
                        });
                        */
                    },
                    'BeforeUpload': function(up, file) {
                           // 每个文件上传前,处理相关的事情
                            console.log('马上开始上传');
                    },
                    'UploadProgress': function(up, file) {
                        // 每个文件上传时,处理相关的事情
                        _this.uPercent = file.percent;
                        _this.upSpeed = file.speed;
                    },
                    'FileUploaded': function(up, file, info) {
                           // 每个文件上传成功后,处理相关的事情
                           // 其中 info 是文件上传成功后，服务端返回的json，形式如
                           // {
                           //    "hash": "Fh8xVqod2MQ1mocfI4S4KpRL6D98",
                           //    "key": "gogopher.jpg"
                           //  }
                           // 参考http://developer.qiniu.com/docs/v6/api/overview/up/response/simple-response.html

                           var domain = up.getOption('domain');
                     
                           var res = eval("("+info+")");
                           var sourceLink = domain + '/' + res.key;// 获取上传成功后的文件的Url
                           console.log('res信息是：'+info);
                           _this.qiniuReturnBody = res;
                           console.log('文件的地址是：'+sourceLink);

                           /*更新上传文件缩略图地址*/
                           _this.uploadPic = sourceLink;
                           /**/
                           _this.uPersent = '上传完成';
                           document.getElementById('present').style.display="none";

                           /*更改按钮状态*/
                           _this.uploadBtn = 'finish';

                           /*设置新闻数据的封面URL*/
                           _this.newsData.imgs = sourceLink;
                    },
                    'Error': function(up, err, errTip) {
                           //上传出错时,处理相关的事情
                           //alert('上传出错！请重试');
                            console.log(up, err, errTip);
                            _this.uPersent = '上传出错！请刷新页面重试';
                            _this.uPercent = 0;
                    },
                    'UploadComplete': function() {
                           //队列文件处理完毕后,处理相关的事情
                        console.log('队列处理完成啦！');
                    },
                    'Key': function(up, file) {
                        // 若想在前端对每个文件的key进行个性化处理，可以配置该函数
                        // 该配置必须要在 unique_names: false , save_key: false 时才生效

                        var key = "";
                        // do something with key here
                        return key
                    }
                }
            });

        },
        startUpload:function(){
            console.log(this.qiniu.files);
            this.uPersent = '正在上传';
            this.qiniu.start();
        },
        submitData:function(){
            var regurl = /^http:\/\/[w-]?/;
            if(this.newsData.catId == 'null'){
                alert('请选择新闻分类！');
                return;
            }
            if(this.newsData.title == ''){
                alert('请输入新闻标题！');
                return;
            }
            if(this.newsData.describ == ''){
                alert('请输入新闻描述！');
                return;
            }
            if(!regurl.test(this.newsData.nurl)){
                alert('请输入完整的正确URL地址！');
                return;
            }
            if(this.newsData.imgs == ''){
                alert('请先上传新闻缩略图！');
                return;
            }

            //发送请求
            var postNews = {
                "categoryID": Number(this.newsData.catId),
                "logoFile": {
                    "bucket": this.qnBucket,
                    "key": this.qiniuReturnBody.key,
                    "mimeType": this.qiniuReturnBody.mimeType,
                    "fileSize": this.qiniuReturnBody.fileSize
                },
                "title": this.newsData.title,
                "synopsis": this.newsData.describ,
                "link": this.newsData.nurl
            };

            indexController.request.setApiName('/News/Article/CreateAndApply');
            indexController.request.setRequest(postNews);
            indexController.request.post();
            var resData = indexController.request.getResponse();
            //console.log(postNews);
            console.log(eval('('+resData+')'));
        }

    }
});

/*通用list列表*/
var commonList = Vue.component('commonList', {
    template: '<div><ul class="list-gropu ulTable">\
                  <li class="list-group-item list-title">\
                      <div class="text-center" :style="{\'flex\':\' \'+head.flex}" v-for="head in titles">{{head.title}}</div>\
                  </li>\
                  <li v-if="!datafrom.length" class="list-group-item"><div class="btn-block btn">空</div></li>\
                  <li class="list-group-item" v-for="list in datafrom" v-on:click="viewDetail(list)">\
                      <div v-for="head in titles" :style="{\'flex\':\' \'+head.flex}">\
                          <div v-for="(val,key) in list" v-if="head.key == key">\
                              <div v-if="head.type == \'img\'">\
                                  <img :src="val" />\
                              </div>\
                              <div v-else>{{val}}</div>\
                          </div>\
                      </div>\
                  </li>\
              </ul>\
              <div class="text-center">\
                  <span class="btn btn-sm btn-success" v-on:click="thisPageData(\'first\')">第一页</span>\
                  <span class="btn btn-sm btn-success" v-on:click="thisPageData(\'prev\')">上一页</span>\
                  <span class="btn btn-sm btn-default active" v-if="datafrom.length<20">下一页</span>\
                  <span class="btn btn-sm btn-success" v-else v-on:click="thisPageData(\'next\')">下一页</span>\
              </div></div>',
    data:function(){
        return {"listSet":listSet,listData:[]}
    },
    props:['datafrom','titles'],
    mounted:function(){
        console.log('通用模版列表加载完成');
        let _this = this;
        eventCenter.$on('showList',function(app,model){
            console.log('列表组件监听到的app值是：'+app+';model的值是：'+model);
        })
    },
    methods:{
        viewDetail:function(listData){
            let _this = this;
            eventCenter.$emit('showDetail',listData);
            //调用alerts弹框
            //eventCenter.$emit('alerts',listData);
        },
        thisPageData:function(action){
            eventCenter.$emit('changePage',action);
        }
    }
});

/*左侧列表组件*/
Vue.component('left-menu', {
    template: '<ul class="list-group">\
                  <li class="list-group-item" v-for="(val,key,index) in menus">\
                      <div :id="\'fm_\'+index" v-on:click="val.open = !val.open">{{val.title}}</div>\
                      <transition>\
                          <ul :id="\'c_fm_\'+index"class="second-menu" v-show="val.open">\
                              <li :class="{\'bg-primary\':activeLi == index+\'_\'+sindex}" v-for="(val,key,sindex)menu in val.list" v-on:click="setList(index,sindex,val.app,val.model)">{{val.title}}</li>\
                          </ul>\
                      </transition>\
                  </li>\
              </ul>',
    props:['menus'],
    data: function () {
        return { "activeLi": '' }
    },
    methods: {
        setList: function (index,sindex,app,model) {
            /*设置当前选中*/
            this.activeLi = index+'_'+sindex;
            eventCenter.$emit('showList',app,model);
        }
    },
    mounted:function(){
        console.log('letf-menu加载完成');
    }
});

/*loading动画*/
var loading = Vue.component('loading',{
    template:'<div class="loadingdiv" :class="{\'hide\':!loaded}">\
                  <div class="words">玩儿命加载中...</div>\
                      <div class="loadingouter">\
                      <div class="dot"></div>\
                      <div class="dot"></div>\
                      <div class="dot"></div>\
                      <div class="dot"></div>\
                      <div class="dot"></div>\
                  </div>\
              </div>',
    props:['loaded']
});

/*新实例仅仅作为事件中心管理中心*/
var eventCenter = new Vue();
eventCenter.$on('showList',function(app,model){
    console.log('主vue实例监听到的app值是：'+app+';model的值是：'+model);

    if(app == 'news' && model == 'newsAdd'){
        //渲染发布新闻组件
        indexController.cps = 'publishNews'
        return;
    }else{
        indexController.cps = 'commonList'
    }

    /*渲染列表表头*/
    indexController.app = app;
    indexController.model = model;
    indexController.requestModel = indexController.request.getJsonModel(app,model);
    indexController.apiName = indexController.requestModel.apiName;
    indexController.listTitle = indexController.requestModel.listTitle;

    /*清空数据*/
    indexController.listData = [];
    /*请求相关数据列表*/
    indexController.request.setApiName(indexController.requestModel.apiName);

    var jsonData = {};

    indexController.requestModel.parameter.map(function(item,i){
        if (item.key == 'pageIndex') {
            indexController.currentPage = item.value;
            jsonData[item.key] = indexController.currentPage;
        }else{
            jsonData[item.key] = item.value;
        }
    });
    indexController.request.setRequest(jsonData);
    indexController.request.post();
    indexController.listData = indexController.request.getResponse();
});
/*翻页监听*/
eventCenter.$on('changePage',function(action){
    console.log('主vue实例监听到的翻页事件值是：'+action);
    if(action == 'first'){
        indexController.currentPage = 0;
    }
    else if(action == 'prev'){
        if(indexController.currentPage == 0){
            alert('已经是第一页');
            return
        }else{
            indexController.currentPage --;
        }
    }
    else if(action == 'next'){
        indexController.currentPage ++;
    }

    /*请求相关数据列表*/
    indexController.request.setApiName(indexController.requestModel.apiName);
    var jsonData = {};

    indexController.requestModel.parameter.map(function(item,i){
        if (item.key == 'pageIndex') {
            jsonData[item.key] = indexController.currentPage || 0;
        }else{
            jsonData[item.key] = item.value;
        }
    });
    indexController.request.setRequest(jsonData);
    indexController.request.post();
    indexController.listData = indexController.request.getResponse();
});
eventCenter.$on('showDetail',function(listData){
    //设置请求详情页的参数
    var app = indexController.requestModel.info.app;
    var model = indexController.requestModel.info.model;
    var  jsonData = {};
    var detailParameter = indexController.requestModel.info.parameter;
    jsonData[detailParameter] = listData[detailParameter];
    var jsonModel = indexController.request.getJsonModel(app,model);

    /*请求详情页*/
    indexController.request.setApiName(jsonModel.apiName);
    indexController.request.setRequest(jsonData);
    indexController.request.post();
    /*详情页的模态框显示隐藏控制*/
    indexController.$refs.detailView.showModal = !indexController.$refs.detailView.showModal;

    /*设置详情页的数据*/
    let newData = {};
    let detailData = indexController.request.getResponse();
    //indexController.$refs.detailView.data = ;

    for(let i = 0; i<jsonModel.listTitle.length;i++){
        newData[jsonModel.listTitle[i].title] = '<img src="">';//detailData[jsonModel.listTitle[i].key]
        if(jsonModel.listTitle[i].type == 'img'){
            newData[jsonModel.listTitle[i].title] = '<img src="'+detailData[jsonModel.listTitle[i].key]+'" width="100">';
        }else if(jsonModel.listTitle[i].type == 'imgs'){
            let imgs = '';
            let imgArr = detailData[jsonModel.listTitle[i].key];
        
            imgArr.map(function(item,index){
                imgs+= '<img src="'+item+'" width="100">&nbsp;&nbsp;&nbsp;&nbsp;';
            });
            newData[jsonModel.listTitle[i].title] = imgs;
        }else{
            newData[jsonModel.listTitle[i].title] = detailData[jsonModel.listTitle[i].key] ? '<span>'+detailData[jsonModel.listTitle[i].key]+'</span>' : '-';
        }
      
        //for(let j = 0;j<jsonModel.listTitle.length;j++)
    }

    indexController.$refs.detailView.data = newData;
    //indexController.$refs.detailView.bD = jsonModel.setMenu[jsonModel.setMenu];

    /*直接将参数（parmeter）转化为所对应的值*/
    jsonModel.setMenu.map(function(item,index){
        item.parameter = detailData[item.parameter];
    });
    /*设置详情页按钮*/
    indexController.$refs.detailView.detailBtns = jsonModel.setMenu;
});
